<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css"/>
    <script type="application/javascript" src="/js/jquery-3.4.1.min.js"></script>
    <script type="application/javascript" src="/js/bootstrap.bundle.min.js"/>
    <script type="application/javascript" src="/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light" th:fragment="topBar">
    <a class="navbar-brand" th:href="@{/}">BBS</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarSupportedContent">
        <ul class="navbar-nav mr-auto">
            <!--<li class="nav-item active">
                <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
            </li>-->
            <form class="form-inline my-2 my-lg-0">
                <input class="form-control mr-sm-2" type="search" placeholder="搜索问题" aria-label="Search">
                <button class="btn btn-outline-success my-2 my-sm-0" type="submit">搜索</button>
            </form>
        </ul>
        <ul class="navbar-nav navbar-right">
            <li th:if="${session.user != null}"><a class="nav-link" href="/publish">发布</a></li>
            <li th:if="${session.user != null}"><a class="nav-link" th:href="@{/profile/replies}">回复<span
                    class="badge badge-light" style="background: #d44343">9</span></a></li>
            <li class="nav-item" th:if="${session.user == null}">
                <a class="nav-link"
                   href="https://github.com/login/oauth/authorize?client_id=0edababf293cfd3a6950&redirect_uri=http://localhost:8887/callback&scope=user&state=1">登录
                    <span class="sr-only">(current)</span></a>
            </li>
            <li class="nav-item dropdown" th:if="${session.user != null}">
                <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
                   data-toggle="dropdown"
                   aria-haspopup="true" aria-expanded="false" th:text="${session.user.name}">
                    <!-- 我 -->
                </a>
                <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                    <a class="dropdown-item" href="#">个人信息</a>
                    <a class="dropdown-item" th:href="@{/profile/questions}">我的问题</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" th:href="@{/logout}">退出登录</a>
                </div>
            </li>
        </ul>
    </div>
</nav>
</body>
</html>